<?php

namespace common\validate;

class TaskWorkOrder extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')->append('param.filter', 'array')->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.name', 'require|max:128')->append('data.code', 'max:128')->append(
                'data.color', 'require|max:7'
            )->append('data.problem_step_category_ids', 'array')->append('data.variable', 'max:8')->append(
                'data.engine', 'max:128'
            )->append('data.batch', 'max:128');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // CreateTaskWorkOrder 验证场景定义
    public function sceneCreateTaskWorkOrder()
    {
        return $this->append('data', 'require')->append('data.type', 'require|in:task_making,review_feedback,repair')
            ->append('data.task_id', 'require|integer')->append('data.category_id', 'integer')->append(
                'data.problem_step_category_ids', 'array'
            );
    }

    public function sceneGetTaskWorkOrderRecordById()
    {
        return $this->append('param', 'require')->append('param.filter', 'require')->append(
                'param.filter.task_id', 'require'
            )->append('param.filter.type', 'string');
    }

    public function sceneTaskWorkOrderRecordTree()
    {
        return $this->append('param', 'require')->append('param.filter', 'require');
    }

    public function sceneSelectAssetTaskWorkOrderSelect()
    {
        return $this->append('param', 'require')->append('param.filter', 'require')
            //            ->append('param.filter.step_category_id', 'require|integer')
            ->append('param.filter.task_work_order_type', 'require|in:task_making,review_feedback');
    }

    public function sceneTaskWorkOrderRecordDetails()
    {
        return $this->append('param', 'require')->append('param.filter', 'require')->append(
                'param.filter.task_work_order_id', 'require'
            );
    }

    public function sceneReplyTaskWorkOrder()
    {
        return $this->append('data', 'require')->append('data.task_work_order_id', 'require|integer')->append(
                'data.note_media', 'array'
            )->append('data.replier_type', 'require|in:created_by,receiver');
    }

    public function sceneDealReviewFeedbackTaskWorkOrder()
    {
        return $this->append('data', 'require')->append('data.is_confirm', 'require|in:yes,no')->append(
                'data.id', 'require|integer'
            );
    }

    // processManage 验证场景定义
    public function sceneProcessManage()
    {
        return $this->append('param.filter.project_id', 'require|integer')->append('param.page.0', 'require|integer')
            ->append(
                'param.page.1', 'require|integer'
            )//            ->append('param.filter.step_category_id', 'require|integer')
            ;
    }

    public function sceneUpdateTaskWorkOrder()
    {
        return $this->append('data', 'require')->append('data.id', 'require')->append('data.status', 'integer')->append(
                'data.category_id', 'integer'
            );
    }

    public function sceneTaskWorkOrderInformation()
    {
        return $this->append('param.filter.task_work_order_id', 'require|integer');
    }

    public function sceneClearTaskWorkUnread()
    {
        return $this->append('data', 'require')->append('data.id', 'require')->append(
                'data.type', 'require|in:work_order_record,deal_work_order'
            );
    }

    public function sceneGetWorkOrderRepairWorkOrder()
    {
        return $this->append('param', 'require')->append('param.filter', 'require');
    }

    public function sceneGetRepairOrderAffectedTask()
    {
        return $this->append('param', 'require')->append('param.filter', 'require');
    }

    public function sceneGetEntityRepairWorkOrder()
    {
        return $this->append('param', 'require')->append('param.filter', 'require');
    }

    // Join 验证场景定义
    public function sceneJoin()
    {
        return $this->append('param.task_work_order_id', 'require|integer');
    }

    // List 验证场景定义
    public function sceneList()
    {
        return $this->append('param', 'array')->append('param.filter', 'array')->append('param.page', 'array');
    }

    // TypeCount 验证场景定义
    public function sceneTypeCount()
    {
        return $this->append('param', 'array')->append('param.filter', 'array');
    }

    // Report 验证场景定义
    public function sceneReport()
    {
        return $this->append('param', 'array')->append('param.filter', 'array')->append(
                'param.report_type', 'require|in:task_work_order_report_type,step_category'
            )->append('param.step_category_type', 'require|in:report_step_category,relate_step_category');
    }

    // ReportAndAddFeedback 验证场景定义
    public function sceneReportAndAddFeedback()
    {
        return $this->append('data.note', 'require')->append('data.start_repair_task_id', 'require|integer')->append(
                'data.want_repair_task_id', 'require|integer'
            )->append('data.problem_step_category_ids', 'array')->append(
                'data.report_type', 'require|in:feedback_only,report_and_add_feedback'
            )->append('data.work_order_id', 'requireIf:data.report_type,feedback_only|integer');
    }

    public function sceneRepairNoteEntityList()
    {
        return $this->append('param.task_work_order_id', 'require|integer')->append('param.page', 'array');
    }

    public function sceneIsExistTaskWorkOrderDefaultOptionMember()
    {
        return $this->append('param.filter.project_id', 'require|integer')->append(
                'param.filter.problem_step_category_ids', 'require|array'
            );
    }

    // 工作待办-我的工单验证
    public function sceneGetMyTodoTaskWorkOrderList()
    {
        return $this->append('param', 'array')
//			->append('param.task_work_order_id', 'require|array')
//			->append('param.filter', 'array')
			->append('param.page', 'array');
    }
    // 工作待办-自定义统计验证
    public function sceneGetMyTodoTaskWorkOrderCount()
    {
        return $this->append('param', 'array');
//			->append('param.task_work_order_id', 'require|array')
//			->append('param.filter', 'require|array');
    }
	// 全量获取我的待办工单数据id
	public function sceneGetTodoTaskStatisticsOnTheLeft()
	{
		return $this->append('param', 'array');
	}
}
